home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / RKMLibsPrgs / intuition / screens / screen34to37.c < prev   
C/C++ Source or Header  |  1992-09-03  |  4KB  |  106 lines

  1. ;/* screen34to37.c - Execute me to compile me with SAS 5.10
  2. LC -b1 -cfistq -v -y -j73 screen34to37.c
  3. blink FROM LIB:c.o screen34to37.o TO screen34to37 LIB LIB:lc.lib LIB:amiga.lib
  4. quit
  5. */
  6.  
  7. /*
  8. Copyright (c) 1992 Commodore-Amiga, Inc.
  9.  
  10. This example is provided in electronic form by Commodore-Amiga, Inc. for
  11. use with the "Amiga ROM Kernel Reference Manual: Libraries", 3rd Edition,
  12. published by Addison-Wesley (ISBN 0-201-56774-1).
  13.  
  14. The "Amiga ROM Kernel Reference Manual: Libraries" contains additional
  15. information on the correct usage of the techniques and operating system
  16. functions presented in these examples.  The source and executable code
  17. of these examples may only be distributed in free electronic form, via
  18. bulletin board or as part of a fully non-commercial and freely
  19. redistributable diskette.  Both the source and executable code (including
  20. comments) must be included, without modification, in any copy.  This
  21. example may not be published in printed form or distributed with any
  22. commercial product.  However, the programming techniques and support
  23. routines set forth in these examples may be used in the development
  24. of original executable software products for Commodore Amiga computers.
  25.  
  26. All other rights reserved.
  27.  
  28. This example is provided "as-is" and is subject to change; no
  29. warranties are made.  All use is at your own risk. No liability or
  30. responsibility is assumed.
  31. */
  32.  
  33.  
  34. #define INTUI_V36_NAMES_ONLY         /* We'll use the newer Intuition names. */
  35.  
  36. #include <exec/types.h>              /* Amiga data types.              */
  37. #include <intuition/intuition.h>     /* Lots of important Intuition    */
  38. #include <intuition/screens.h>       /* structures we will be using.   */
  39.  
  40. #include <clib/exec_protos.h>        /* Function prototypes            */
  41. #include <clib/dos_protos.h>
  42. #include <clib/intuition_protos.h>
  43.  
  44. #ifdef LATTICE
  45. int CXBRK(void)    { return(0); }    /* Disable Lattice CTRL/C handling */
  46. int chkabort(void) { return(0); }    /* really */
  47. #endif
  48.  
  49. struct Library *IntuitionBase;       /* Intuition library base          */
  50.  
  51. /* Simple example to show how to open a custom screen that gives the new look
  52.  * under V37, yet still works with older version of the operating system.
  53.  * Attach the tag SA_Pens and a minimal pen specification to ExtNewScreen,
  54.  * and call the old OpenScreen() function.  The tags will be ignored by
  55.  * V34 and earlier versions of the OS.  In V36 and later the tags are
  56.  * accepted by Intuition.
  57. */
  58.  
  59. VOID main(int argc, char **argv)
  60. {
  61. UWORD pens[] = { ~0 };               /* This is the minimal pen specification*/
  62. struct Screen      *my_screen;       /* Pointer to our new, custom screen    */
  63. struct ExtNewScreen myscreen_setup;  /* Same as NewScreen with tags attached */
  64. struct TagItem      myscreen_tags[2];/* A small tag array                    */
  65.  
  66. /* Open the library before you call any functions */
  67. IntuitionBase = OpenLibrary("intuition.library",0);
  68. if (NULL != IntuitionBase)
  69.    {
  70.       /* Fill in the tag list with the minimal pen specification */
  71.       myscreen_tags[0].ti_Tag=SA_Pens;
  72.       myscreen_tags[0].ti_Data=(ULONG) pens;
  73.       myscreen_tags[1].ti_Tag=TAG_DONE;
  74.  
  75.       /* The screen is opened two bitplanes deep so that the
  76.       ** new look will show-up better.
  77.       **/
  78.       myscreen_setup.LeftEdge=0;
  79.       myscreen_setup.TopEdge=0;
  80.       myscreen_setup.Width=640;              /* Smaller values here reduce   */
  81.       myscreen_setup.Height=STDSCREENHEIGHT; /* drawing area and save memory.*/
  82.       myscreen_setup.Depth=2;                /* Two planes means 4 colors.   */
  83.       myscreen_setup.DetailPen=0;            /* Normal V34 pen colors.       */
  84.       myscreen_setup.BlockPen=1;
  85.       myscreen_setup.ViewModes=HIRES;
  86.       myscreen_setup.Type=CUSTOMSCREEN | NS_EXTENDED; /* Extended NewScreen flag */
  87.       myscreen_setup.Font=NULL;
  88.       myscreen_setup.DefaultTitle="My Screen";
  89.       myscreen_setup.Gadgets=NULL;
  90.       myscreen_setup.CustomBitMap=NULL;
  91.       /* Attach the pen specification tags to the ExtNewScreen structure */
  92.       myscreen_setup.Extension=myscreen_tags;
  93.  
  94.       if (NULL != (my_screen =
  95.         OpenScreen((struct NewScreen *)&myscreen_setup)));
  96.           {
  97.           /* screen successfully opened */
  98.  
  99.           Delay(200L);  /* normally the program would be here */
  100.  
  101.           CloseScreen(my_screen);
  102.           }
  103.       CloseLibrary(IntuitionBase);
  104.    }
  105. }
  106.